<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
set_time_limit(0);
$intSuppleID = intval($_data["SuppleID"]);
$intBT = intval($_data["Bet_Type"]);
$intGID = intval($_data["GambleID"]);
$flOdds = floatval($_data["Odds"]);
$flOdds2 = floatval($_data["Odds2"]);
$flStakMoney = floatval($_data["StakeMoney"]);
$isSpecial = trim($_data["isSpecial"]);
$intMemID = intval($_data["MemID"]);
$strSerialNo = trim($_data["SerialNo"]);
$intSpecialNumType = intval($_data["SpecialNumType"]);
$intOddsID = intval($_data["OddsID"]);
$intOddsID2 = intval($_data["OddsID2"]);

//檢驗傳入資料
if($intBT < 1 || $intGID < 1 || $intLottoID < 1 || $flOdds <= 0 || $flStakMoney <= 0 || $intMemID <= 0 || $strSerialNo == ""){
	$GLOBALS["errormessage"] = "Data Error!!";
	$GLOBALS["errorhidden"] = "\nBetType:".$intBT."\nGambleID:".$intGID."\nLottoID:".$intLottoID."\nflOdds:".$flOdds."\nStakeMoney:".$flStakMoney."\nMemID:".$intMemID."\nSerialNo:".$strSerialNo."\nLine:".__LINE__."\nPage:".__FILE__;
	AddData_Log($_SESSION["Admin_Info"] -> ID,"階層補貨下注參數錯誤 ", print_r($_data, true));
	$arrResult["isWager"] = true;
	$arrResult["WagerCon"] = "Data Error!!";
	return;
	//ErrMsgOutputHTML("Erro1r", "", 1);
}

switch($intBT){
	default:
		$strNumber = $_data["Number"];
		break;
}
$arrCheckKey = split(" ", microtime());
$arrResult = RealSuppleWager($intLottoID, $intLType, $intGID, $intBT, $strNumber, $flStakMoney, $intOddsID, $flOdds, $intOddsID2, $flOdds2, "", $arrCheckKey[0],  $arrCheckKey[1]+1);

if($arrResult["isWager"] == false){
	$GLOBALS["errormessage"] = $arrResult["WagerCon"];
	AddData_Log($_SESSION["Admin_Info"] -> ID,"階層補貨下注失敗 ", "Error:".$arrResult["WagerCon"]."\n".print_r($_data, true));
	//ErrMsgOutputHTML("Error2", "", 1);
}else{
	AddData_Log($_SESSION["Admin_Info"] -> ID,"階層補貨下注成功 ", print_r($_data, true));
}

switch($intBT){
	case 7:
	case 8:
	case 9:
	case 10:
	case 11:
	case 13:
		/*=================================================================*/
		header("Cache-Control: no-store, no-cache, must-revalidate");	  // HTTP/1.1
		header("Cache-Control: post-check=0, pre-check=0", false);
		header("Pragma: no-cache");										  // HTTP/1.0
		$arrResult["WagerCon"] = str_replace(chr(10), "", $arrResult["WagerTip"]."<br />".$arrResult["WagerCon"]);
		$arrResult["WagerCon"] = str_replace(chr(13), "", $arrResult["WagerCon"]);
		?><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<script language="JavaScript">
		<!--
		parent.document.getElementById("SuppleResult").innerHTML='<?php print addslashes($arrResult["WagerCon"]);?>';
		parent.open_SuppleResultWin();
		parent.ChangeBet(<?php print $intBT;?>);
		//-->
		</script><?php
		exit();
		break;
}
?>